package com.common.zrd.validation.support;


import com.common.zrd.validation.errorcode.ErrorCode;

public class SystemErrorCodeDefine
        implements ErrorCode {
    private String errorCodeKey;
    private String errorCodeMessage;

    public SystemErrorCodeDefine(String errorCodeKey) {
        this(errorCodeKey, null);
    }

    SystemErrorCodeDefine(String errorCodeKey, String errorCodeMessage) {
        this.errorCodeKey = errorCodeKey;
        this.errorCodeMessage = errorCodeMessage;
    }

    @Override
    public String getErrorCode() {
        return this.errorCodeKey;
    }

    @Override
    public String toString(Object... binding) {
        return ErrorCodeResourceLoader.internalBind(this.errorCodeMessage, binding);
    }

    @Override
    public String toString() {
        return this.errorCodeMessage;
    }

    void setErrorCodeKey(String errorCodeKey) {
        this.errorCodeKey = errorCodeKey;
    }

    void setErrorCodeMessage(String errorCodeMessage) {
        this.errorCodeMessage = errorCodeMessage;
    }
}
